package com.zhaoyue.study.util;

import org.apache.commons.lang3.math.NumberUtils;

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.math.BigDecimal;

/**
 * @author zhaoyue
 * @description:
 * @create 2018-11-19 下午6:26
 **/
public class MathDemo {


    public static final int getProcessID() {
        RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
        System.out.println(runtimeMXBean.getName());
        return Integer.valueOf(runtimeMXBean.getName().split("@")[0])
                .intValue();
    }

    public static void main(String[] args) throws Exception {
        System.out.println(Math.max(10, 12));
        System.out.println(Math.abs(-4));
        System.out.println(Math.pow(2, 3));
        System.out.println(Math.random());
        System.out.println(Math.log(8));

        System.out.println();

        NumberUtils.min(2,4,5,6);

        System.out.println(NumberUtils.toInt(null));
        System.out.println(NumberUtils.toInt(""));
        System.out.println(NumberUtils.toInt("1"));

        System.out.println(NumberUtils.toInt(null,2));
        System.out.println(NumberUtils.toInt("",3));
        System.out.println(NumberUtils.toInt("1",2));

        BigDecimal bigDecimal = NumberUtils.createBigDecimal("11");
        Integer integer = NumberUtils.createInteger("12");



    }
}
